package com.bto.solar.work.controller;

import com.bto.solar.work.service.BtoExcelService;
import com.bto.solar.work.utils.ServletUtils;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Objects;

/**
 * @author 王小波
 * @description:
 * @date 2023/9/11 8:27
 */

@RestController
@RequestMapping("/excel-download")
public class ExcelController {
    @Autowired
    private BtoExcelService btoExcelService;

    @ApiModelProperty("导出订单信息")
    @GetMapping("orders-info")
    public void downloadExcelOrderInfo(@RequestParam List<String> orderIds , @RequestParam List<String> columns)  {
        try {
            btoExcelService.batchExportOrderInfo(orderIds , columns , Objects.requireNonNull(ServletUtils.getResponse()));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }




}
